<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>

<script src="${ctxWebStatic}/laydate/laydate.js"></script>
<style type="text/css">
em.error {
	height: 18px;
	display: inline-block;
	vertical-align: middle;
	margin-right: 2px;
	margin-left: 20px;
	background: url("${ctxWebStatic}/images/error_img.png") no-repeat 0px
		0px;
	padding-left: 24px;
	color: #d3001e;
	font-size: 16px;
	font-family: "微软雅黑";
}
</style>
<meta name="decorator" content="center_common" />
<script>
	//防止重复提交
	var subflag = false;

	$(function() {
		$("#form").validate({
			rules : {
				email : {
					required : true,
					email : true,
					remote : {
						type : "POST",
						url : "${ctxWeb}/companyInfo/checkEmail", //servlet
						data : {
							email : function() {
								return $("#email").val();
							},
							oldEmail: function() {
								return $("#oldEmail").val();
							},
						}
					}
				},
				linkmanPhone : {
					required : true,
					minlength : 11,
					remote : {
						type : "POST",
						url : "${ctxWeb}/companyInfo/checkLinkmanMobile", //servlet
						data : {
							linkmanPhone : function() {
								return $("#linkmanPhone").val();
							},
							oldLinkmanPhone : function() {
								return $("#oldLinkmanPhone").val();
							}
						}
					}
				}
			},
			messages : {
				email : {
					required : '请输入电子邮件',
					email : '请检查电子邮件的格式',
					remote : '邮箱已存在'
				},
				linkmanPhone : {
					required : '请输入手机号码',
					minlength : '格式不正确',
					remote : '手机号存在'
				}
			},
			errorElement : "em",
		});
		//设为默认
		$(".default_box").click(function() {
			if ($(this).parent().find("i").hasClass("search_chose_hover")) {
				$(this).parent().find("i").removeClass("search_chose_hover");
			} else {
				$(this).parent().find("i").addClass("search_chose_hover");
			}
			var Inputindex = $('.parts_search_list').index($(this));
			$(".numRadio").find('input').eq(Inputindex).click();
		});

		//弹框
		$(".js_edit,.add_address").click(function() {
			$("#proment_new_address").show();
		});
		$(".close_page,.shopping_car_confirm a").click(function() {
			$("#proment_new_address").hide();
		});

		var that
		$(".js_del").click(function() {
			$("#del_tk").show();
			that = $(this).parents("tr");
			console.log(that);

		});

		$('.cancle').on('click', function() {
			$("#del_tk").hide();
		});
		$('.submit').on('click', function() {
			$("#del_tk").hide();
			that.remove();
		})
		//设默认地址
		$(".js_set").click(
				function() {
					$(this).parents(".table").find(".js_set").removeClass(
							"col_gry ");
					$(this).parents(".table").find(".our_bd").removeClass(
							"our_adress_item ");
					$(this).addClass("col_gry ");
					$(this).parents(".table tr").find(".our_bd").addClass(
							"our_adress_item ");
				});
	})

	function submit() {
		if(subflag){
			return;
		}
		var checkFlag = true;

		if (!$("#form").valid()) {
			checkFlag = false;
		}

		if (!checkFlag) {
			return false;
		}
		$("form").submit();
		subflag = true;
	    window.setTimeout(function () { $ ('#sussessBox').show ().delay (2000).fadeOut () }, 1000);
	}
</script>
</head>
<body>
	<!--主题内容-->
	<div class="">
		<div class="container">
			<div class="row">
				<!-- pc 订单管理 -->
				<div class="Credit_box clearfix">
					<c:if test="${yongUser.userType==2}">
						<!-- 右边部分 -->
						<div class="col-sm-10 pad20 pad_10">
							<div class="Credit_right">
								<!--企业信息-->
								<div class="goods_detail_info_box mar_16 clearfix">
									<h3>
										<span>企业信息</span>

									</h3>
									<div class="our_adress_table our_company_box  clearfix">
										<p class="clearfix">
											<em>营业执照公司名称：</em> <span>${yongUser.company}</span>
										</p>
										<p class="clearfix">
											<em>企业类型：</em> <span>${fns:getDictLabel(yongUser.companyType, 'company_type', '')}</span>
										</p>
										<p class="clearfix">
											<em>企业规模：</em> <span>${fns:getDictLabel(yongUser.companySize, 'company_size', '')}</span>
										</p>
										<p class="clearfix">
											<em>企业所在地 ：</em> 
											<span>
												${yongUser.provinceName}
												${yongUser.cityName}
												${yongUser.areaName}
												${yongUser.address } 
											</span>
										</p>
										<p class="up_list_img clearfix">
											<em>企业信息上传：</em> 
											<span> 
												<c:if test="${yongUser.titleImage!=null && yongUser.titleImage!=''}">
													<img src="${ctxWeb}/web/file/getFile?filePath=${yongUser.titleImage}" data-action="zoom" />
												</c:if>
												<c:if test="${yongUser.businessLicence!=null && yongUser.businessLicence!=''}">
													<img src="${ctxWeb}/web/file/getFile?filePath=${yongUser.businessLicence}" data-action="zoom" />
												</c:if>
												<c:if test="${yongUser.openBankAccountPermitCertificate!=null && yongUser.openBankAccountPermitCertificate!=''}">
													<img src="${ctxWeb}/web/file/getFile?filePath=${yongUser.openBankAccountPermitCertificate}" data-action="zoom" />
												</c:if>
												<c:if test="${yongUser.organizationCodeCertificate!=null && yongUser.organizationCodeCertificate!=''}">
													<img src="${ctxWeb}/web/file/getFile?filePath=${yongUser.organizationCodeCertificate}" data-action="zoom" />
												</c:if>
												<c:if test="${yongUser.taxRegistrationCertificate!=null && yongUser.taxRegistrationCertificate!=''}">
													<img src="${ctxWeb}/web/file/getFile?filePath=${yongUser.taxRegistrationCertificate}" data-action="zoom" />
												</c:if>
											</span>
										</p>
									</div>
								</div>
								<!--企业信息结束-->
								<!--联系人信息-->
								<div class="goods_detail_info_box mar_16 clearfix">
									<h3>
										<span>联系人信息</span>
									</h3>
									<form:form modelAttribute="yongUser" class="company_msg clearfix"
										id="form" action="${ctxWeb}/companyInfo/update" method="post">
										<form:input path="id" type="hidden"/>
										<div class="form-group clearfix">
											<label for="firstname"
												class="col-sm-3 col-xs-4 input_info control-label">
												<i class="must_img"></i>联系人：
											</label>
											<div class="col-sm-9 col-xs-8 input_left">
												<form:input type="text" class="form-control" path="linkman" placeholder="请输入企业联系人"/>
											</div>
										</div>
										<div class="form-group clearfix">
											<label for="firstname"
												class="col-sm-3 col-xs-4 input_info control-label">
												<i class="must_img"></i>电话号码：
											</label>
											<div class="col-sm-9 col-xs-8 input_left">
												<input id="oldLinkmanPhone" name="oldLinkmanPhone" type="hidden" value="${yongUser.linkmanPhone}">
												<form:input type="tel" class="form-control" path="linkmanPhone" maxlength="11" placeholder="请输入联系人电话号码"/>
											</div>
										</div>
										<div class="form-group clearfix">
											<label for="firstname"
												class="col-sm-3 col-xs-4 input_info control-label">
												<i class="must_img"></i>电子邮箱：
											</label>
											<div class="col-sm-9 col-xs-8 input_left">
												<input id="oldEmail" name="oldEmail" type="hidden" value="${yongUser.email}">
												<form:input type="email" class="form-control" path="email" placeholder="请输入电子邮箱"/>
											</div>
										</div>
										<p
											class="register_btn mar_t30 col-sm-offset-3 col-xs-offset-4">
											<a href="javascript:void(0)" onclick="submit()">修改</a>
										</p>
									</form:form>
								</div>
								<!--联系人信息结束-->
							</div>
						</div>
						<!-- 右边部分 end-->
					</c:if>
					<c:if test="${yongUser.userType==1}">
						<div class="col-sm-10 pad20 pad_10">
							<div class="Credit_right">
								<!--企业信息-->
								<div class="goods_detail_info_box mar_16 clearfix">
									<h3>
										<span>企业信息</span>
									</h3>
									<div class="company_info_none">
										<p>
											暂无企业信息， <a href="${ctxWeb}/register/toAssociator">升级企业会员</a>
										</p>
									</div>
								</div>
								<!--企业信息结束-->
							</div>
						</div>
					</c:if>

				</div>
				<!-- pc 订单管理 end -->
			</div>
		</div>
	</div>
	<!--主题内容-->
	
	<!--弹框-->
	<div class="jd_tk" style="display: none;" id="sussessBox">
	    <div class="delet_box">
	        <div class="jd_win_tit">修改企业信息成功！</div>
	    </div>
	</div>
	<!--弹框结束-->
</body>
</html>